Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] WebGPU EP [skip ci] #21904

Closed
wants to merge 167 commits into from
Closed

[WIP] WebGPU EP [skip ci] #21904

wants to merge 167 commits into from

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Aug 28, 2024

Description

For code review purpose only. Offer a place for discussion.

see also:

prerequisite:

related changes:

TODO items

  • Validation Switch (allows to change the behavior of whether perform specific validation checks)
  • pushErrorScope/popErrorScope
  • Graph Capture
  • Profiling supported by WebGPU Query Buffer
  • WebGPU resources tracking (mainly for buffers)
  • Global hanlders( unhandled exceptions and device lost )
  • Fix CI breaks (macOS)

edgchen1 and others added 19 commits October 11, 2024 14:36
### Description
<!-- Describe your changes. -->

Remove unused variable.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Fix Android build error:

```
onnxruntime/onnxruntime/core/providers/webgpu/webgpu_context.h:122:12: error: private field 'query_time_base_' is not used [-Werror,-Wunused-private-field]
  122 |   uint64_t query_time_base_;
      |            ^
1 error generated.
```
### Description

This change allows to set EP option "forceCpuNodeNames" in which
includes a list of node names that will always be running on CPU.

Usage example:

```diff
            opt.executionProviders[0] = {
                name: "webgpu",
                validationMode: 'wgpuOnly',
                storageBufferCacheMode: 'bucket',
+               // force node "/model/embed_tokens/Gather" to be put on CPU
+               forceCpuNodeNames: "/model/embed_tokens/Gather"
            };

```
### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
@jlucaso1
Copy link

@fs-eire on this branch is it already possible to test in nodejs, compiling in my side?

@fs-eire
Copy link
Contributor Author

fs-eire commented Oct 21, 2024

@fs-eire on this branch is it already possible to test in nodejs, compiling in my side?

Yes. Just do build with flags --config Release --use_webgpu --build_nodejs and it should work.

qjia7 and others added 5 commits October 21, 2024 23:52
The MacOS device on CI is an Apple Paravirtual device, which may not
support TimestampQuery. In this PR, If TimestampQuery is not supported,
a warning is printed to not block profiling cpu data.
### Description

introduce this build flag --use_external_dawn to allow specifying Dawn
as an external dependency. When it is specified, `dawn::native` is
excluded from build of onnxruntime, and passing in dawn proc table is
required.

I didn't find a good way to run the test. Currently I need to build with
the following flags:
```sh
C:\code\onnxruntime>build --use_webgpu --use_external_dawn --skip_tests --target onnxruntime_webgpu_external_dawn_test
```

And run the test using:
```sh
# run test that passing dawn proc table. expect session to initialize successfully
C:\code\onnxruntime\build\Windows\Debug\Debug>onnxruntime_webgpu_external_dawn_test.exe

# run test that does not pass proc table. expect exception to throw.
C:\code\onnxruntime\build\Windows\Debug\Debug>onnxruntime_webgpu_external_dawn_test.exe --no_proc_table
```
@fs-eire
Copy link
Contributor Author

fs-eire commented Oct 31, 2024

Most part of this working branch is already merged into main, or in review. Close this draft.

future PRs can target main branch directly.

@fs-eire fs-eire closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.